import { createRouter, createWebHistory } from "vue-router";
import PersonMainPage from "pages/PersonMainPage.vue";
import Mine from "pages/mine.vue"
import SearchProject from "pages/SearchProject.vue"
import Home from "pages/Home.vue"
import ProjectDetails from "pages/ProjectDetails.vue"
import CreateProject from "../pages/CreateProject.vue";
import ChangeProject from "../pages/ChangeProject.vue";
import ChangeUserInfo from "../pages/ChangeUserInfo.vue";
import SearchRecruit from "../pages/SearchRecruit.vue";
import QQLogin from "../pages/QQLogin.vue";
import QQLoginRedictVue from "../pages/QQLoginRedict.vue";
import RecruitManage from "../pages/RecruitManage.vue";
import ChangeRecruit from "../pages/ChangeRecruit.vue";
import CreateRecruit from "../pages/CreateRecruit.vue";
import MemberManager from "../pages/MemberManager.vue";
import RecruitDetail from "../pages/RecruitDetails.vue";
import ApplyManage from "../pages/ApplyManage.vue"
import Developing from "../components/Developing.vue";
import ApplyCompetition from '../pages/ApplyCompetition.vue'
const routes = [{
        path: '/mine',
        component: Mine,
        meta: {
            title: "个人主页"
        }
    },
    {
        path: "/login",
        component: QQLogin,
        meta: {
            title: "QQ登陆"
        }
    },
    {
        path: "/project/:pid/applyCompetition",
        component: ApplyCompetition,
        meta: {
            title: "报名参赛"
        }
    },
    {
        path: "/QQlogin",
        component: QQLoginRedictVue,
        meta: {
            title: "跳转"
        }
    },
    {
        path: '/home',
        component: Home,
        meta: {
            title: "首页"
        }
    },
    {
        path: '/',
        component: Home,
        meta: {
            title: "首页"
        }
    },
    {
        path: "/user/:uid",
        component: PersonMainPage,
        meta: {
            title: "用户信息"
        }
    },
    {
        path: "/user/infoupdate",
        component: ChangeUserInfo,
        meta: {
            title: "修改个人信息"
        }
    },
    {
        path: "/project/search",
        component: SearchProject,
        meta: {
            title: "搜索项目"
        }
    },
    {
        path: "/project/detail/:pid",
        component: ProjectDetails,
        meta: {
            title: "项目详情"
        }
    },
    {
        path: "/project/create",
        component: CreateProject,
        meta: {
            title: "创建项目"
        }
    },
    {
        path: "/project/update/:pid",
        component: ChangeProject,
        meta: {
            title: "修改项目"
        }
    },
    {
        path: "/recruit/search",
        component: SearchRecruit,
        meta: {
            title: "搜索招募"
        }
    },
    {
        path: "/project/recruit/:pid",
        component: RecruitManage,
        meta: {
            title: "招募管理"
        }
    },
    {
        path: "/recruit/update/:rid",
        component: ChangeRecruit,
        meta: {
            title: "修改招募信息"
        }
    },
    {
        path: "/recruit/create/:pid",
        component: CreateRecruit,
        meta: {
            title: "创建招募"
        }
    },
    {
        path: "/project/member/:pid",
        component: MemberManager,
        meta: {
            title: "成员管理"
        }
    },
    {
        path: "/project/apply/:pid",
        component: ApplyManage,
        meta: {
            title: "项目申请"
        }
    },
    {
        path: "/recruit/detail/:rid",
        component: RecruitDetail,
        meta: {
            title: "招募详情"
        }
    },
    {
        path: "/developing",
        component: Developing,
        meta: {
            title: "开发中"
        }
    },
];

const router = createRouter({
    history: createWebHistory("/zhaomu"),
    routes
});
router.beforeEach((to, from) => {
    document.title = to.meta.title || "校园招募"
})

export default router;